//
//  ViewController.m
//  30104
//
//  Created by student on 16/3/17.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"
#import "MyButton.h"
@interface ViewController ()

@property (weak, nonatomic) IBOutlet UIButton *btn;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
  
}


- (IBAction)btnPressed:(MyButton *)sender {
    if (sender.addBtn!=nil) {
        [sender.addBtn removeFromSuperview];
    }
    else{
        UIButton *btn=[[UIButton alloc]init];
        btn.bounds=CGRectMake(0, 0, 200, 200);
        btn.center=CGPointMake(100, -100);
        
        [btn setBackgroundImage:[UIImage imageNamed:@"对话框.png"] forState:UIControlStateNormal];
        [btn setBackgroundImage:[UIImage imageNamed:@"小孩.png"] forState:UIControlStateHighlighted];
        [sender addSubview:btn];
        
        sender.addBtn = btn;

    }
}


@end
